<?php 
	namespace Helpers\Session;

	function session_reset($app){
		$oldsid = session_id();
		session_start();
		$app['db']->delete('session', array('session_id'=>$oldsid));
		echo "uid ses into reset $oldsid <br>";
		session_unset();
		session_destroy();
		session_start();
		$sid = session_id();
		echo "uid ses into reset $sid <br>";

		$_SESSION['uid'] = 0;
		$_SESSION['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'];
		$sql1 = "SELECT count(*) count FROM session WHERE session_id = ?";
		$res = $app['db']->fetchAssoc($sql1, array( (string) $sid ) );
		if($res['count'] == 0){
			//$sql2 = "INSERT INTO session (session_id, session_time ) VALUES (? , now() )";
			$app['db']->executeQuery($sql2, array( (string) $sid ));
		}												
	}
?>




